package com.alibaba.algo.core.base;

/**
 * Created by IntelliJ IDEA.
 * User: glorysongglory
 * Date: 2020/5/9
 * Time: 9:06
 */
public enum Order {
    Desc("desc"), Asc("asc"),
    ;

    private String code;

    Order(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public static Order forCode(String code) {
        Order[] or = Order.values();
        for (Order order : or) {
            if (order.getCode().equalsIgnoreCase(code)) {
                return order;
            }
        }
        return null;
    }
}
